package com.animations;

import com.beans.BackgroundBean;
import creator.ui.graphics.Magicanvas;
import creator.ui.graphics.polaroid.Animation;
import java.awt.Graphics;
import java.awt.Image;
import java.util.ArrayList;

public class BgAction extends Animation {

  private BackgroundBean bg;
  private Image currentBg;

  public void loadBean() {
    this.bg = new BackgroundBean();
    getBeans().add(this.bg);
  }

  public void paint(Graphics g) {
    if (this.currentBg == null) this.currentBg = this.bg.getBg();
    g.drawImage(
      this.currentBg,
      this.bg.getBgX(),
      this.bg.getBgY(),
      this.bg.getBgW(),
      this.bg.getBgH(),
      getMagicanvas()
    );
  }

  public void run() {
    getMagicanvas().repaint();
  }
}
